import React, { PureComponent } from 'react'
import { CSSTransition } from 'react-transition-group'
import './App.css'

export class App extends PureComponent {
  constructor(props) {
    super(props)

    this.state = {
      isShowTitle: false
    }
  }
  render() {
    const { isShowTitle } = this.state
    return (
      <div>
        {
          <CSSTransition in={isShowTitle} unmountOnExit={true} classNames="title" timeout={1000}>
            <div>我是标题</div>
          </CSSTransition>
        }
        <button onClick={() => this.setState({isShowTitle: !isShowTitle})}>切换</button>
      </div>
    )
  }
}

export default App